package com.intranet.fund.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.intranet.fund.domain.Email;
import com.intranet.sys.domain.User;
import com.water.dao.BaseDao;
import com.water.dao.Page;
@Repository
public class EmailDao extends BaseDao<Email>{

	private final String GET_EMAIL_BY_STATUS = "from Email e where e.status = ?";

	public Page queryEmailList(int pageNo, int pageSize,String param) {
		StringBuffer sb = new StringBuffer();
		sb.append("from Email where 1=1");
		if(param!=null && !param.equals("")){
			sb.append(" and (account like '%"+param+"%' or owner like '%"+param+"%' or status like '%"+param+"%')");
		}
		sb.append(" order by id");
		return pagedQuery(sb.toString(), pageNo, pageSize);
	}
	
	public List<Email> getAllEmailByStatus(String status) {
		List<Email> list = getHibernateTemplate().find(GET_EMAIL_BY_STATUS,status);
		return list;
	}
}
